import request from "./request";

// 登录
export function getuser() {
    return request.get("/user");
}


export function login(account, password) {
    return request({
        url: '/admin/login',
        method: 'post',
        data: {
            username: account,
            passwordHash: password
        }
    })
}

export function logout() {
    return request({
        url: 'admin/logout',
        method: 'delete',
    })
}

// 拉取管理员信息
export function getUserInfo() {
    return request({
        url: '/admin/user/info',
        method: 'get'
    })
}


// 拉取管理员角色
export function getUserRole() {
    return request({
        url: '/admin/user/role',
        method: 'get'
    })
}

export function getUserRouters() {
    return request({
        url: '/admin/user/routes',
        method: 'get',
    })
}

// 修改用户信息
export function editUserInfo(data) {
    return request({
        url: '/admin/user/editInfo',
        method: "put",
        data
    })
}

// 修改用户头像
export function editUserAvatar(data) {
    return request({
        url: '/admin/user/editAvatar',
        method: 'put',
        data
    })
}